package com.bawei.android_mianshi.service

import android.app.Service
import android.content.Intent
import android.os.Binder
import android.os.IBinder
import android.util.Log

class TwoService : Service() {
    override fun onCreate() {
        super.onCreate()
        Log.d("TwoService", "onCreate: ")
    }
    //绑定服务
    override fun onBind(intent: Intent): IBinder {
        Log.d("TwoService", "onBind: ")
       return TwoBinder()
    }

    override fun onRebind(intent: Intent?) {
        super.onRebind(intent)
        Log.d("TwoService", "onRebind: ")
    }
    //解绑
    override fun onUnbind(intent: Intent?): Boolean {
        Log.d("TwoService", "onUnbind: ")
        return true
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d("TwoService", "onDestroy: ")
    }
    //代理对象

    class TwoBinder:Binder(){
        fun jiehun():String{
            return "柴少龙和Xxx结婚了"
        }
    }

}